import React from "react";
import styles from "./index.module.less";
import SvgIcon from "@components/SvgIcon";
import defaultHead from "@images/sex0.webp";

const First = () => {
    return (
        <div className={styles.first}>
            <SvgIcon font="icon-daochu1024-26" />
        </div>
    );
};
const Second = () => {
    return (
        <div className={styles.second}>
            <SvgIcon font="icon-daochu1024-27" />
        </div>
    );
};
const Third = () => {
    return (
        <div className={styles.third}>
            <SvgIcon font="icon-daochu1024-28" />
        </div>
    );
};

const Item = (props) => {
    const { item, isMy } = props;

    return (
        <div className={`${styles.item} ${isMy ? styles.my : ""}`}>
            <div className={styles.sort}>
                {item.sort === 1 ? (
                    <First />
                ) : item.sort === 2 ? (
                    <Second />
                ) : item.sort === 3 ? (
                    <Third />
                ) : item.sort ? (
                    item.sort
                ) : (
                    "--"
                )}
            </div>
            <div className={styles.user_msg}>
                <div className={styles.user_head}>
                    <img
                        src={
                            item.avatarUrl
                                ? require(`@images/head/${item.avatarUrl}`)
                                : defaultHead
                        }
                        alt=""
                    />
                </div>
                <p className={styles.user_name}>
                    {item.userName || "虚位以待"}
                </p>
            </div>
            <p className={styles.msg_nums}>
                {item.leaveMessageNumber
                    ? item.leaveMessageNumber
                    : item.leaveMessageNumber === 0
                    ? 0
                    : "--"}
            </p>
            <p className={styles.accept_nums}>
                {item.acceptedNumber
                    ? item.acceptedNumber
                    : item.acceptedNumber === 0
                    ? 0
                    : "--"}
            </p>
            <p className={styles.like_nums}>
                {item.likedNumber
                    ? item.likedNumber
                    : item.likedNumber === 0
                    ? 0
                    : "--"}
            </p>
            <div className={styles.hot_wrap}>
                <div className={styles.hot_icon}>
                    <SvgIcon font="icon-huo" />
                </div>
                <p className={styles.hot_nums}>{item.hotNumber || "--"}</p>
            </div>
        </div>
    );
};

export default Item;
